package com.zhu.service.cms.controller.web;

import com.zhu.commons.utils.R;
import com.zhu.service.cms.pojo.CmsAd;
import com.zhu.service.cms.service.ICmsAdService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("api/cms/intro")
@Api(tags = "前端广告列表")
public class CmsWebApi {
   @Autowired
   private ICmsAdService adService;

    @ApiOperation(value = "获取广告（具体信息）")
    @GetMapping("/list/{id}")
    public R list(@PathVariable String id){
      List<CmsAd> adList= adService.selectById(id);
      if(adList!=null){
          return R.ok().data("items",adList);
      }
      return R.error().message("error");
   }


}
